package util;

import java.util.List;

/**
 * 分页工具类
 */
public class PageSupport {
    private int totalCount;    //总记录数
    private int totalPages;    //总页数
    private int currentPage;   //当前页码
    private int pageSize;      //每页显示多少条
    private List<?> list;  //分页数据

    public int getTotalCount() {
        return totalCount;
    }

    public void setTotalCount(int totalCount) {
        this.totalCount = totalCount;
    }

    public int getTotalPages() {
        if(totalCount>0){
            if(totalCount%pageSize==0){
                totalPages=totalCount/pageSize;
            }else{
                totalPages=totalCount/pageSize+1;
            }
        }

        return totalPages;
    }

    public void setTotalPages(int totalPages) {
        this.totalPages = totalPages;
    }

    public int getCurrentPage() {
      return currentPage;
    }

    public void setCurrentPage(int currentPage) {
        this.currentPage = currentPage;
    }

    public int getPageSize() {
        return pageSize;
    }

    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
    }

    public List<?> getList() {
        return list;
    }

    public void setList(List<?> list) {
        this.list = list;
    }
}
